export class TimerProxy {
    private action: any;
    private ctxObj;
    constructor(action: any, ctxObj: any) {
        this.action = action;
        this.ctxObj = ctxObj;
    }

    private timer;
    private timerOn: boolean = false;

    SetTimer(interval: number) {
        this.timer = setInterval(this.action.bind(this.ctxObj), interval);
    }
    ClearTimer() {
        clearInterval(this.timer);
    }
    StartTimer(interval: number) {
        if (!this.timerOn) {
            this.timerOn = true;
            this.SetTimer(interval);
        }
    }
    StopTimer() {
        this.timerOn = false;
        this.ClearTimer();
    }
}